#include <cstdio>
#include <cmath>
#define min(x,y) (((x)<(y))?(x):(y))
#define max(x,y) (((x)>(y))?(x):(y))
#define abs(x) (((x)>0)?(x):-(x))
const double pi = acos( -1 );

double f1[ 10 ], f2[ 10 ];

int main( )
{
    int n, m, i, j, d;
    double k, ans;
    char cmd[ 2 ];
    bool flag;
    while ( scanf("%d%d", &n, &m) != EOF )
    {
        if ( n == 0 && m == 0 ) break;
        for ( i = 0; i < m; i++ ) f1[ i ] = 0;
        flag = false;
        while ( n-- )
        {
            scanf("%s%lf", cmd, &k);
            if ( cmd[ 0 ] == 'R' )
            {
                if ( flag )
                    for ( i = 0; i < m; i++ )
                        f2[ i ] = f1[ i ] + ( 5 + i * 10 + k ) * pi / 2;
                else
                    for ( i = 0; i < m; i++ )
                        f2[ i ] = f1[ m - i - 1 ] + ( 5 + i * 10 + k ) * pi / 2;
                flag = true;
            }
            if ( cmd[ 0 ] == 'L' )
            {
                if ( flag )
                    for ( i = 0; i < m; i++ )
                        f2[ i ] = f1[ m - i - 1 ] + ( 5 + i * 10 + k ) * pi / 2;
                else
                    for ( i = 0; i < m; i++ )
                        f2[ i ] = f1[ i ] + ( 5 + i * 10 + k ) * pi / 2;
                flag = false;
            }
            if ( cmd[ 0 ] == 'S' )
            {
                for ( i = 0; i < m; i++ )
                {
                    f2[ i ] = f1[ i ] + k;
                    for ( j = 0; j < m; j++ )
                    {
                        d = abs( i - j );
                        if ( d * 100 > k ) continue;
                        f2[ i ] = min( f2[ i ], f1[ j ] + sqrt( d * 10 * d * 10 + k * k ) );
                    }
                }
            }
            for ( i = 0; i < m; i++ ) f1[ i ] = f2[ i ];
        }
        ans = f1[ 0 ];
        for ( i = 1; i < m; i++ ) ans = min( ans, f1[ i ] );
        printf("%.2lf\n", ans);
    }
    return 0;
}
